/*
 * List.h
 *
 *  Created on: Feb 20, 2011
 *      Author: akcilap
 */

#ifndef STACK_H_
#define STACK_H_

class Stack {
private:
	struct node {
		node* next, *previous;
		int val;
	};
	node* start, *end;
	int size;
public:
	Stack() {
		start = end = 0;
		size = 0;
	}
	~Stack() {
		while(size > 1) {
			end = end->previous;
			delete end->next;
		}
		delete end;
	}
	void push(int val);
	void pop();
	int getTop() { return end->val; }
	int getSize() { return size; }
};

#endif /* STACK_H_ */
